<?php 
//添加CMS分类
function update_post_term($post_id,$term_id){
	if ($post_id&&$term_id) {
			$data['object_id']=$post_id;
			$data['term_id']=$term_id;
			$data['table']='posts';
			$term_relationships=M('term_relationships');
			if ($term_relationships->where('object_id=%d',array($post_id))->find()) {
				$term_relationships->where('object_id=%d',array($post_id))->save($data);
			}else{
				$term_relationships->add($data);
			}
			
	}
}